fix: allow header propagation for router-plugins#2877
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughAdds router support for configurable gRPC DialOptions, preserves existing outgoing gRPC metadata during plugin invocations, and introduces test helpers plus integration tests validating HTTP header propagation into outgoing gRPC subgraph metadata for both binary and OCI plugins. ChangesgRPC Plugin Dial Options and Header Forwarding
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Comment |
Router-nonroot image scan passed✅ No security vulnerabilities found in image: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2877 +/- ##
===========================================
+ Coverage 40.86% 66.28% +25.41%
===========================================
Files 1037 258 -779
Lines 131332 27084 -104248
Branches 6176 0 -6176
===========================================
- Hits 53672 17952 -35720
+ Misses 75914 7721 -68193
+ Partials 1746 1411 -335
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@router-tests/protocol/router_plugin_test.go`:
- Around line 624-956: Enable telemetry for at least one subtest so the
telemetry-injection regression path is exercised: pick a subtest (e.g., the
"unsafe headers are absent from metadata" case) and modify the testenv.Config
passed to testenv.Run to turn telemetry on (for example by adding Telemetry:
testenv.TelemetryConfig{Enabled: true} or the equivalent flag in your test
harness), keeping the rest of the RouterOptions (captureInterceptor,
core.WithHeaderRules) unchanged so captureInterceptor, testenv.Run and
testenv.Config still validate that telemetry-injected outgoing metadata does not
overwrite/escape header propagation rules.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d7778b56-1b63-420e-bbd2-035501e41492
📒 Files selected for processing (8)
router-tests/protocol/router_plugin_test.gorouter-tests/router_oci_plugin_test.gorouter/core/graph_server.gorouter/core/router.gorouter/core/router_config.gorouter/pkg/grpcconnector/grpccommon/grpc_plugin_client.gorouter/pkg/grpcconnector/grpcplugin/grpc_plugin.gorouter/pkg/grpcconnector/grpcpluginoci/grpc_oci_plugin.go
There was a problem hiding this comment.
♻️ Duplicate comments (1)
router-tests/protocol/router_plugin_test.go (1)
622-628:⚠️ Potential issue | 🟠 Major | ⚡ Quick winEnable telemetry for this header-forwarding suite invocation.
This run still executes the matrix without telemetry, so the metadata-merge regression path is not exercised.
Proposed minimal patch
func TestRouterPluginWithHeaderForwarding(t *testing.T) { t.Run("Should send http headers as gRPC metadata to subgraphs", func(t *testing.T) { t.Parallel() + exporter := tracetest.NewInMemoryExporter(t) testenv.RunGRPCPluginHeaderCases(t, testenv.Config{ + TraceExporter: exporter, RouterConfigJSONTemplate: testenv.ConfigWithPluginsJSONTemplate, Plugins: testenv.PluginConfig{ Enabled: true, Path: "../../router/plugins", }, }) }) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@router-tests/protocol/router_plugin_test.go` around lines 622 - 628, The header-forwarding test call currently omits telemetry and must enable it so the metadata-merge regression path is exercised: in the testenv.RunGRPCPluginHeaderCases invocation, add a telemetry flag to the testenv.Config literal (e.g. TelemetryEnabled: true) alongside RouterConfigJSONTemplate and Plugins so the matrix runs with telemetry enabled; update the test invocation that uses testenv.Config to include this new field (referencing RunGRPCPluginHeaderCases and testenv.Config/Plugins).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@router-tests/protocol/router_plugin_test.go`:
- Around line 622-628: The header-forwarding test call currently omits telemetry
and must enable it so the metadata-merge regression path is exercised: in the
testenv.RunGRPCPluginHeaderCases invocation, add a telemetry flag to the
testenv.Config literal (e.g. TelemetryEnabled: true) alongside
RouterConfigJSONTemplate and Plugins so the matrix runs with telemetry enabled;
update the test invocation that uses testenv.Config to include this new field
(referencing RunGRPCPluginHeaderCases and testenv.Config/Plugins).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cb765fbc-f3a9-4c89-a02d-0df72f12d396
📒 Files selected for processing (3)
router-tests/protocol/router_plugin_test.gorouter-tests/router_oci_plugin_test.gorouter-tests/testenv/grpc_plugin_header_cases.go
…ritten-in-grpc-plugin-middleware
…ritten-in-grpc-plugin-middleware
This PR fixes an issue that header propagation was not working for router-plugins if telemetry was enabled. Instead the metadata was overwritten by the plugin-client invoke logic.
Summary by CodeRabbit
New Features
Tests
Checklist
Open Source AI Manifesto
This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.